From 1a16a7d6845d36c0810963f75243ad43ea69c593 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 25 Aug 2023 16:58:44 -0400 Subject: [PATCH] switchroot: Use g_new/g_free consistently Coverity complains about this, even though they're the same thing. --- src/libotcore/otcore-prepare-root.c | 6 +++--- src/switchroot/ostree-prepare-root.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libotcore/otcore-prepare-root.c b/src/libotcore/otcore-prepare-root.c index 189c2a14..f7523ef6 100644 --- a/src/libotcore/otcore-prepare-root.c +++ b/src/libotcore/otcore-prepare-root.c @@ -82,12 +82,12 @@ otcore_get_ostree_target (const char *cmdline, char **out_target, GError **error { if (strcmp (slot_suffix, "_a") == 0) { - *out_target = strdup (slot_a); + *out_target = g_strdup (slot_a); return TRUE; } else if (strcmp (slot_suffix, "_b") == 0) { - *out_target = strdup (slot_b); + *out_target = g_strdup (slot_b); return TRUE; } return glnx_throw (error, "androidboot.slot_suffix invalid: %s", slot_suffix); @@ -98,7 +98,7 @@ otcore_get_ostree_target (const char *cmdline, char **out_target, GError **error */ if (proc_cmdline_has_key_starting_with (cmdline, "androidboot.")) { - *out_target = strdup (slot_a); + *out_target = g_strdup (slot_a); return TRUE; } diff --git a/src/switchroot/ostree-prepare-root.c b/src/switchroot/ostree-prepare-root.c index 05cef492..203722da 100644 --- a/src/switchroot/ostree-prepare-root.c +++ b/src/switchroot/ostree-prepare-root.c @@ -247,8 +247,8 @@ static void free_composefs_config (ComposefsConfig *config) { g_ptr_array_unref (config->pubkeys); - free (config->signature_pubkey); - free (config); + g_free (config->signature_pubkey); + g_free (config); } G_DEFINE_AUTOPTR_CLEANUP_FUNC (ComposefsConfig, free_composefs_config) -- 2.30.2